import { DataTypes, Sequelize } from 'sequelize';

const sequelize = new Sequelize({
    dialect: 'sqlite',
    storage: './database.sqlite'
});


const Location = sequelize.define('location', {
    id: DataTypes.NUMBER,
    name: DataTypes.STRING
});

const Device = sequelize.define('device', {
    id: DataTypes.NUMBER,
    name: DataTypes.STRING,
    type: DataTypes.NUMBER,
    location: DataTypes.STRING,
    guid: DataTypes.STRING
});

const Converter = sequelize.define('converter', {
    id: DataTypes.NUMBER,
    sn: DataTypes.STRING,
    type: DataTypes.NUMBER,
    no: DataTypes.NUMBER,
    nodeId: DataTypes.NUMBER,
    deviceId: DataTypes.NUMBER
});


const Serial = sequelize.define('serial', {
    id: DataTypes.NUMBER,
    nodeId: DataTypes.NUMBER,
    addr: DataTypes.NUMBER,
    deviceId: DataTypes.NUMBER
});

const Node = sequelize.define('node', {
    id: DataTypes.NUMBER,
    sn: DataTypes.STRING
});